package com.zrrd.order;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@MapperScan("com.zrrd.order.mapper")
@SpringBootApplication
/*
    @EnableFeignClients 是一个注解，
    用于启用 Feign 客户端的功能。它通常在 Spring Boot 项目的配置类上使用。
 */
//defaultConfiguration = DefaultFeignConfiguration.class 设置默认的配置
//设置全局生效
//@EnableFeignClients(defaultConfiguration = DefaultFeignConfiguration.class)
//设置指定服务生效：
//@EnableFeignClients(value ="usersevice", defaultConfiguration = DefaultFeignConfiguration.class)
@EnableFeignClients(basePackages = "com.zrrd.feign.client")
public class OrderApplication {

    public static void main(String[] args) {
        SpringApplication.run(OrderApplication.class, args);
    }

    /*
    1、注册一个RestTemplate的实例到Spring容器
     */
    @Bean
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }


}